﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ASKM.Rachao.Model.Exceptions;

namespace ASKM.Rachao.Model
{
    /// <summary>
    /// PlayerProfile partial class
    /// </summary>
    public partial class PlayerProfile: IValidation
    {

        #region IValidation Members

        /// <summary>
        /// Performs data validation
        /// </summary>
        public void Validate()
        {
            List<String> errors = new List<string>();

            if (String.IsNullOrEmpty(this.Name) || String.IsNullOrWhiteSpace(this.Name))
                errors.Add(ASKM.Rachao.Resources.Model.Validation.Name_Required);

            if (String.IsNullOrEmpty(this.Lastname) || String.IsNullOrWhiteSpace(this.Lastname))
                errors.Add(ASKM.Rachao.Resources.Model.Validation.Lastname_Required);

            if (String.IsNullOrEmpty(this.Email) || String.IsNullOrWhiteSpace(this.Email))
                errors.Add(ASKM.Rachao.Resources.Model.Validation.Email_Required);

            if (errors.Count > 0)
                throw new RachaoBusinessException(false, errors.ToArray());    
        }

        #endregion
    }
}
